package com.yesep.learn.design.structural.proxy;

/**
 * 静态代理
 */
public class StaticLoggerProxy implements ILogger {
    private final JDKLogger realLogger;

    public StaticLoggerProxy(String name) {
        this.realLogger = new JDKLogger(name);
    }

    @Override
    public void log(String message) {
        // 执行一些额外的操作，比如格式化日志消息
        String formattedMessage = formatMessage(message);
        realLogger.log(formattedMessage);
    }

    private String formatMessage(String message) {
        // 格式化日志消息
        return "[Static Logger][" + getCurrentTime() + "] " + message;
    }

}